home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / cp1.zip / DAC2.C < prev    next >
C/C++ Source or Header  |  1993-04-29  |  1KB  |  47 lines

  1. ===========================================================================
  2.  BBS: The Abacus * HST/DS * Potterville, MI
  3. Date: 04-25-93 (18:43)             Number: 145
  4. From: DOUG RICKARD                 Refer#: 20
  5.   To: PATRICK FOX                   Recvd: NO  
  6. Subj: dac output                     Conf: (36) C Language
  7. ---------------------------------------------------------------------------
  8. /* DAC2.C */
  9. /* Create saw tooth waveform */
  10.  
  11. #include <conio.h>
  12.  
  13. int main(void)
  14. {
  15. char i;
  16. unsigned int porta = 0x378;
  17. unsigned int portc = 0x37A;
  18. unsigned int clock = 0x021;
  19.  
  20.     outp(clock,(inp(clock) | 1)); /* Disable clock interrupts */
  21.  
  22.     for (;;)
  23.         {
  24.             for (i=0;i<128;i++)
  25.                 {
  26.                     outp(portc,255);       /* Generate a synch pulse  */
  27.                     outp(portc,0);         /* for an oscilloscope     */
  28.                 }
  29.  
  30.             for (i=0;i<256;i++)    /* Cycle through 256 steps */
  31.                 {
  32.                     outp(porta,i); /* Send output to DAC      */
  33.                 }
  34.          }
  35.  
  36.     outp(clock,(inp(clock) & 0xFE)); /* Re-enable clock interrupts */
  37.  
  38.     return 1;
  39. }
  40.  
  41.  
  42. --- Maximus/2 2.01wb
  43.  * Origin: Brisbug PC User Group BBS (3:640/821)
  44. SEEN-BY: 1/211 11/2 4 13/13 101/1 108/89 109/25 110/69 114/5 123/19 124/1
  45. SEEN-BY: 153/752 154/40 77 157/2 159/100 125 575 950 203/23 209/209 280/1
  46. SEEN-BY: 390/1 396/1 5 15 2270/1 2440/5 3603/20
  47.